<?php
// +-------------------------------------------------------------------
// | 
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Admin\Controller;

use Kcdns\Admin\Controller\CommonController;

class ZsGoodsRegController extends CommonController
{
    public function add()
    {
    try {
	       if (IS_POST) {
	           if(!$_POST['zs_goods_reg.mid']){
                   $auid = session('user_auth.uid');
                   $_POST['zs_goods_reg.mid'] = $auid;

               }else{
                   $no = I('post.zs_goods_reg.mid','');
                   if($no != session('user_auth.uid')){
                       throw new \Exception('只能修改自己添加的');
                   }
               }
	       }
	       
	       parent::add();
	    } catch (\Exception $e) {
	       $this->error($e->getMessage());
	    }
    }
    
    public function edit()
    {
    	try {
    		if (IS_POST) {
                $auid = session('user_auth.uid');

    		  $no = I('post.zs_goods_reg.mid','');
    		  if($no != $auid){
                  throw new \Exception('只能修改自己添加的');
              }
    			 
    		}
    		parent::edit();
    	} catch (\Exception $e) {
    		$this->error($e->getMessage());
    	}
    
    }
    
    
    
}